﻿using System;
using EnvDTE;
using EnvDTE80;

namespace Microsoft.WowAddonStudio.Tests.Common.Mocks
{
    /// <summary>
	/// The top-level Mock object in the Visual Studio automation object model.
	/// Use this object for functionality and refer to EnvDTE._DTE for this object’s documentation.
    /// </summary>
    public sealed class MockDTE : DTE, DTE2
    {
        private readonly MockUndoContext undoContext;
    	private MockSolution solution;

		/// <summary>
		/// Initializes a new instance of the <see cref="MockDTE"/> class.
		/// </summary>
        public MockDTE():this(null)
        {
        }

		/// <summary>
		/// Initializes a new instance of the <see cref="MockDTE"/> class.
		/// </summary>
		/// <param name="documents">The documents.</param>
        public MockDTE(Documents documents)
        {
            this.Documents = documents;
            undoContext = new MockUndoContext(this);
        }

		/// <summary>
		/// Sets the mock documents.
		/// </summary>
		/// <param name="documentList">The document list.</param>
        public void SetMockDocuments(Documents documentList)
        {
            Documents = documentList;
        }

        #region DTE Members


		/// <summary>
		/// Gets the active document.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.Document"/> object.</returns>
        public Document ActiveDocument
        {
            get { return Documents.Item(0); }
        }

		/// <summary>
		/// Gets an array of currently selected projects.
		/// </summary>
		/// <value></value>
		/// <returns>An array of currently selected projects.</returns>
        public object ActiveSolutionProjects
        {
            get { return new object[] { SimpleTestServiceLocator.Get<EnvDTE.Project>() }; }
        }

		/// <summary>
		/// Returns the currently active window, or the top-most window if no others are active.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.Window"/> object. Returns Nothing if no windows are open.</returns>
        public Window ActiveWindow
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the <see cref="T:EnvDTE.AddIns"/> collection, which contains all currently available Add-ins.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.AddIns"/> collection.</returns>
        public AddIns AddIns
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Microsoft Internal Use Only.
		/// </summary>
		/// <value></value>
		/// <returns/>
        public DTE Application
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets a reference to the development environment's CommandBars object.
		/// </summary>
		/// <value></value>
		/// <returns>A Microsoft.VisualStudio.CommandBars object.</returns>
        public object CommandBars
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets a string representing the command line arguments.
		/// </summary>
		/// <value></value>
		/// <returns>A string representing the command line arguments.</returns>
        public string CommandLineArguments
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Returns the <see cref="T:EnvDTE.Commands"/> collection.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.Commands"/> collection.</returns>
        public EnvDTE.Commands Commands
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets a <see cref="T:EnvDTE.ContextAttributes"/> collection which allows automation clients to add new attributes to the current selected items in the Dynamic Help window and provide contextual help for the additional attributes.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.ContextAttributes"/> collection.</returns>
        public ContextAttributes ContextAttributes
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the top-level extensibility object.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.DTE"/> object.</returns>
        public DTE DTE
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the debugger objects.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.Debugger"/> object.</returns>
        public Debugger Debugger
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the display mode, either MDI or Tabbed Documents.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.vsDisplay"/> constant representing the display mode.</returns>
        public vsDisplay DisplayMode
        {
            get { throw new NotImplementedException(); }
            set { throw new NotImplementedException(); }
        }

    	/// <summary>
    	/// Gets the collection of open documents in the development environment.
    	/// </summary>
    	/// <value></value>
    	/// <returns>A <see cref="T:EnvDTE.Documents"/> collection.</returns>
    	public Documents Documents { get; set; }

    	/// <summary>
		/// Gets a description of the edition of the environment.
		/// </summary>
		/// <value></value>
		/// <returns>A string representing the description of the environment edition.</returns>
        public string Edition
        {
            get { throw new NotImplementedException(); }
        }

    	#region DTE2 Members

		/// <summary>
		/// Gets a <see cref="T:EnvDTE80.ToolWindows"/> object used as a shortcut for finding tool windows.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE80.ToolWindows"/> object.</returns>
    	public ToolWindows ToolWindows
    	{
    		get { throw new NotImplementedException(); }
    	}

    	#endregion

		/// <summary>
		/// Gets a reference to the <see cref="T:EnvDTE.Events"/> object.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.Events"/> object.</returns>
    	public Events Events
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Executes the specified command.
		/// </summary>
		/// <param name="CommandName">Required. The name of the command to invoke.</param>
		/// <param name="CommandArgs">Optional. A string containing the same arguments you would supply if you were invoking the command from the Command window. If a string is supplied, it is passed to the command line as the command's first argument and is parsed to form the various arguments for the command. This is similar to how commands are invoked in the Command window.</param>
        public void ExecuteCommand(string CommandName, string CommandArgs)
        {
            throw new NotImplementedException();
        }

		/// <summary>
		/// Microsoft Internal Use Only.
		/// </summary>
		/// <value></value>
		/// <returns/>
        public string FileName
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the <see cref="T:EnvDTE.Find"/> object that represents global text find operations.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.Find"/> object.</returns>
        public Find Find
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the full path and name of the object's file.
		/// </summary>
		/// <value></value>
		/// <returns>A string representing the full path and name of the object's file.</returns>
        public string FullName
        {
            get { return Name; }
        }

		/// <summary>
		/// Gets the object.
		/// </summary>
		/// <param name="name">The name.</param>
		/// <returns></returns>
        public object GetObject(string name)
        {
            throw new NotImplementedException();
        }

		/// <summary>
		/// Gets the <see cref="T:EnvDTE.Globals"/> object that contains Add-in values that may be saved in the solution (.sln) file, the project file, or in the user's profile data.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.Globals"/> object.</returns>
        public Globals Globals
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the <see cref="T:EnvDTE.ItemOperations"/> object.
		/// </summary>
		/// <value></value>
		/// <returns>An <see cref="T:EnvDTE.ItemOperations"/> object.</returns>
        public ItemOperations ItemOperations
        {
            get { return new MockItemOperations(this); }
        }

		/// <summary>
		/// Runs a wizard with the supplied parameters.
		/// </summary>
		/// <param name="VSZFile">Required. The .Vsz (wizard) file containing the information required to launch the wizard.</param>
		/// <param name="ContextParams">Required. The parameters for the wizard. The first parameter is a GUID that uniquely identifies the launch context as distinct from Add Item or Add Project or a custom GUID. The remaining arguments are user-defined and their number and values depend on the wizard.Wizards (or templates) that come with Visual Studio — such as Visual Basic Windows Application or Visual C# Console Application—have a required set of context parameters that you must pass to them. For details on these, see ContextParams Enum. Wizards that you create can have more or less parameters.</param>
		/// <returns>
		/// A <see cref="T:EnvDTE.wizardResult"/> object.
		/// </returns>
        public wizardResult LaunchWizard(string VSZFile, ref object[] ContextParams)
        {
            throw new NotImplementedException();
        }

		/// <summary>
		/// Gets the ID of the locale in which the development environment is running.
		/// </summary>
		/// <value></value>
		/// <returns>An integer value representing the ID of the locale in which the development environment is running.</returns>
        public int LocaleID
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the <see cref="T:EnvDTE.Macros"/> object.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.Macros"/> object.</returns>
        public Macros Macros
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the root of the Macros IDE's automation model.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.DTE"/> object.</returns>
        public DTE MacrosIDE
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets a <see cref="T:EnvDTE.Window"/> object representing the main development environment window.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.Window"/> object.</returns>
        public Window MainWindow
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the mode of the development environment, either debug or design.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.vsIDEMode"/> value.</returns>
        public vsIDEMode Mode
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Sets or gets the name of the <see cref="T:EnvDTE._DTE"/> object.
		/// </summary>
		/// <value></value>
		/// <returns>A string representing the name of the <see cref="T:EnvDTE._DTE"/> object.</returns>
        public string Name
        {
            get { return "MockDTE"; }
        }

		/// <summary>
		/// Gets the <see cref="T:EnvDTE.ObjectExtenders"/> object.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.ObjectExtenders"/> object.</returns>
        public ObjectExtenders ObjectExtenders
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Opens the file.
		/// </summary>
		/// <param name="ViewKind">Kind of the view.</param>
		/// <param name="fileName">Name of the file.</param>
		/// <returns></returns>
        public Window OpenFile(string ViewKind, string fileName)
        {
            throw new NotImplementedException();
        }

		/// <summary>
		/// Closes the environment.
		/// </summary>
        public void Quit()
        {
            throw new NotImplementedException();
        }

		/// <summary>
		/// Gets a string with the path to the root of the Visual Studio registry settings.
		/// </summary>
		/// <value></value>
		/// <returns>A string representing the path to the root of the Visual Studio registry settings.</returns>
        public string RegistryRoot
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Satellites the DLL path.
		/// </summary>
		/// <param name="Path">The path.</param>
		/// <param name="name">The name.</param>
		/// <returns></returns>
        public string SatelliteDllPath(string Path, string name)
        {
            throw new NotImplementedException();
        }

		/// <summary>
		/// Gets a color used to draw the user interface within Visual Studio.
		/// </summary>
		/// <param name="Element">Standard color for UI.</param>
		/// <returns>
		/// A color value representing a standard color defined by <see cref="T:EnvDTE80.vsThemeColors"/>.
		/// </returns>
    	public uint GetThemeColor(vsThemeColors Element)
    	{
    		throw new NotImplementedException();
    	}

		/// <summary>
		/// Gets a collection containing the items currently selected in the environment.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.SelectedItems"/> collection.</returns>
    	public SelectedItems SelectedItems
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the <see cref="T:EnvDTE.Solution"/> object that represents all open projects in the current instance of the environment and allows access to the build objects.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.Solution"/> object.</returns>
        public Solution Solution
        {
			get
			{
				if (solution == null)
				{
					solution = new MockSolution(this);
					SimpleTestServiceLocator.Register<Solution>(solution);
				}
				return solution;
			}
        }

		/// <summary>
		/// Gets a <see cref="T:EnvDTE.SourceControl"/> object that allows you to manipulate the source code control state of the file behind the object.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.SourceControl"/> object.</returns>
        public SourceControl SourceControl
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the <see cref="T:EnvDTE.StatusBar"/> object, representing the status bar on the main development environment window.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.StatusBar"/> object.</returns>
        public StatusBar StatusBar
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets or sets whether UI should be displayed during the execution of automation code.
		/// </summary>
		/// <value></value>
		/// <returns>A Boolean value indicating True if the UI is suppressed, False if not.</returns>
        public bool SuppressUI
        {
            get { throw new NotImplementedException(); }
            set { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the global <see cref="T:EnvDTE.UndoContext"/> object.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.UndoContext"/> object.</returns>
        public UndoContext UndoContext
        {
            get { return undoContext; }
        }

		/// <summary>
		/// Sets or gets a value indicating whether the environment was launched by a user or by automation.
		/// </summary>
		/// <value></value>
		/// <returns>true if the environment is running under user control; otherwise, false.</returns>
        public bool UserControl
        {
            get { throw new NotImplementedException(); }
            set { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the host application's version number.
		/// </summary>
		/// <value></value>
		/// <returns>The host application's version number.</returns>
        public string Version
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets the <see cref="T:EnvDTE.WindowConfigurations"/> collection, representing all available window configurations.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.WindowConfigurations"/> collection.</returns>
        public WindowConfigurations WindowConfigurations
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Gets a <see cref="T:EnvDTE.Windows"/> collection containing the windows that display in the object.
		/// </summary>
		/// <value></value>
		/// <returns>A <see cref="T:EnvDTE.Windows"/> collection.</returns>
        public Windows Windows
        {
            get { throw new NotImplementedException(); }
        }

		/// <summary>
		/// Get_s the is open file.
		/// </summary>
		/// <param name="ViewKind">Kind of the view.</param>
		/// <param name="fileName">Name of the file.</param>
		/// <returns></returns>
        public bool get_IsOpenFile(string ViewKind, string fileName)
        {
            throw new NotImplementedException();
        }

		/// <summary>
		/// Get_s the properties.
		/// </summary>
		/// <param name="Category">The category.</param>
		/// <param name="Page">The page.</param>
		/// <returns></returns>
        public Properties get_Properties(string Category, string Page)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}